home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Devpac 2.12 disk 1.adf / examples / demo.s next >
Text File  |  1989-02-06  |  2KB  |  62 lines

  1.     opt    l-,c+,d+        nolink,case dependant,debug
  2.  
  3. * this source code (C) HiSoft 1987 All Rights Reserved
  4. * a simple demo program to print a message on the screen then quit
  5. * it uses the DOS and EXEC libraries.
  6.  
  7. ************************ IMPORTANT *****************************
  8. * the Tutorial as listed in the manual is no longer completely *
  9. * valid. Page 12, 3rd paragraph says 'the assembly worked this *
  10. * time' when, in fact, it will give the message 'odd address'. *
  11. * This error should be ignored for the purpose of the tutorial *
  12. ************************ IMPORTANT *****************************
  13.  
  14.  
  15.     incdir    ":include/"        where to look
  16.  
  17.     include    exec/exec_lib.i        I want to call EXEC
  18.     include    libraries/dos_lib.i    and DOS
  19.     include    libraries/dos.i
  20.  
  21. * start by opening the DOS library
  22. start    move.l    dosname,a1
  23.     moveq    #0,d0            any version
  24.     CALLEXEC OpenLibrary
  25.     tst.l    d0
  26.     beq    quit_fast        quit if cant
  27.  
  28.     move.l    d0,_DOSBase        save pointer
  29.  
  30. * now find our output handle
  31.     CALLDOS    Output
  32.     move.l    d0,d4            d4=output handle
  33.  
  34. * and print a message
  35.     move.l    d4,d1            file handle
  36.     move.l    #string,d2        address of message
  37.     moveq    #stringlen,d3        length
  38.     CALLDOS    Write            and send it
  39.  
  40. * dont close the output handle otherwise the CLI bombs!
  41.  
  42.  
  43. * finished so close DOS library
  44.     mov.l    _DOSBase,a1
  45.     CALLEXEC CloseLibrary
  46.  
  47. quit_fast
  48.     rts                and finish
  49.  
  50. _DOSBase    dc.l    0        space for pointer
  51.  
  52. * strings here
  53.  
  54. string    dc.b    'A Program written with HiSoft''s Devpac Amiga',10
  55. stringlen    equ    *-string
  56.  
  57. * this defines the name of the DOS library
  58. dosname    DOSNAME
  59.  
  60.     even
  61.  
  62.